<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * 短信接口驱动
 */

class Sms_driver_chuanglan extends Sms_driver implements Sms_driver_interface
{
    private $url = "http://222.73.117.156/msg/HttpBatchSendSM";//http://222.73.117.158/msg/HttpBatchSendSM
    private $setting;
    public function load_config($config)
    {
        $this->setting=$config;
    }

    public function send($mobile,$msg)
    {
        $post_data['account'] = $this->setting['account'];
        $post_data['pswd'] = $this->setting['password'];
        $post_data['mobile'] =$mobile;
        $post_data['msg']=$msg;
        $options[CURLOPT_TIMEOUT] = $this->setting['timeout'];
        $result =  $this->curl->simple_post($this->url,$post_data,$options);
        if($result==FALSE)
        {
            return FALSE;
        }
        $result_arr = explode(",",$result);
        if(!isset($result_arr[1]) || $result_arr[1]!=0)
        {
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }
}

